package com.llkj.qingnianguoxue.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.llkj.qingnianguoxue.R;
import com.llkj.qingnianguoxue.bean.SearchResultBean;

import java.util.List;

/**
 * 搜索结果
 */
public class SearchResultAdapter extends BaseQuickAdapter<SearchResultBean.ResultBean, BaseViewHolder> {

    private int mType;//1清除
    public SearchResultAdapter(int layoutResId, List<SearchResultBean.ResultBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, SearchResultBean.ResultBean item) {
        if(mType==1){
            baseViewHolder.addOnClickListener(R.id.ivDelHistory);
            baseViewHolder.setText(R.id.tv_title, item.getSearch());
        }else{
            baseViewHolder.setText(R.id.tv_title, item.getName());
        }
    }

    public void setType(int type){
        mType = type;
    }
}
